/**
 * Created by zhangyanhui on 2017/6/20.
 */
var util = {
    /**
     * 表单查询
     * 传入参数 表单的id
     * <form jump="url">
     *     jump:返回地址
     */
    submitForm : function (id) {
        $.ajax({
            cache: true,
            type: "POST",
            url: $("#"+id).attr("action"),
            data: $("#"+id).serialize(),
            async: false,
            error: function(request) {
                alert("提交失败：" + request);
            },
            success: function(data) {
                var jump = $("#"+id).attr("jump");
                if(jump != undefined && jump != null && jump != ""){
                    window.location.href = jump;
                }else{
                    alert("成功")
                }

            }
        });
    },
    ajaxFun : function (url,param,funObj) {
        $.ajax({
            cache: true,
            type: "POST",
            url: url,
            data: param,
            async: false,
            error: function(request) {
                alert("操作失败：" + request);
            },
            success: funObj
        });
    },
    jump : function (url) {
        window.location.href = url;
    }
}